<?php
namespace app\common\model;

class Featured extends Base {
    protected $autoWriteTimestamp = true;
    protected $table = 'tp_recommend';

    /**
     * 根据类型来获取推荐位列表数据
     * @param $type
     * @return \think\Paginator
     */
    public function getFeaturedsByType($type){
        $data = [
            'type' => $type,
            'status' => ['neq', -1],
        ];

        $order = [
            'listorder' => 'desc',
            'id'=>'desc'
        ];

        $result = $this->where($data)
                    ->order($order)
                    ->paginate();
        return $result;
    }
}